home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c,comp.unix.programmer
- Subject: Re: shellscript to c
- Followup-To: comp.unix.programmer
- Date: 5 Mar 1996 09:39:36 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4hhu8oINN543@keats.ugrad.cs.ubc.ca>
- References: <4hhps3$cof@news.tuwien.ac.at>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4hhps3$cof@news.tuwien.ac.at>,
- Christoph Mack <cmack@rainbow.studorg.tuwien.ac.at> wrote:
- >Hi!
- >
- >I am currently writing a compiler which will be able to translate
- >bourne shell scripts to C. I hope that this will speed the scripts
- >up a bit.
-
- Not likely; at least, not sensible scripts that are used for things that, well,
- scripts ought to be used for, which is the coordination of other commands, file
- manipulation, and the like. More time is spent in the external commands than in
- the interpreter itself.
-
- >The strategie is to do a fork and exec for each unix system call.
- >One problem is output redirection. Does anyone know how to realize
- ><sc1> | <sc2> in C where <sc1> and <sc2> are unix system calls?
- >
- >e.g.: ls -lsa | grep vmlinuz
- > cat textfile.txt | grep "certain words"
-
- ls and grep are not ``system calls''. They are system utility programs. System
- calls are kernel functions like kill() or open().
-
- If you don't know how to set up the execution of pipelines, don't write a shell
- translator into C. It's not a trivial job! You will be tearing your hair out
- within a few days or weeks.
-
- (redirected to comp.unix.programmer)
- --
-
-